#ifndef DEBUG_HPP
#define DEBUG_HPP

#include "Common.hpp"

#include <iostream>

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)

#define DEBUG(fmt, ...)                                                                 \
  do {                                                                                  \
    fprintf(stderr, "DEBUG %s(%u): " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__);      \
  } while (false)

#define ERROR(fmt, ...)                                                                 \
  do {                                                                                  \
    fprintf(stderr, "ERROR %s(%u): " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__);      \
    exit(1);                                                                            \
  } while (false)
    
#define WARNING(fmt, ...)                                                               \
  do {                                                                                  \
    fprintf(stderr, "WARNING %s(%u): " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__);    \                                                                        \
  } while (false)
  
#define PRINT(x)                                                                       \
  do {                                                                                  \
    std::cerr << __FILE__ << ":" << __LINE__ << " " << TOSTRING(x) << std::endl         \
              << (x) << std::endl;                                                      \
  } while (false)
 

  
void _checkError(const char * filename, int line);
  
#define checkError() \
  _checkError(__FILE__, __LINE__)
 
std::ostream& operator<<(std::ostream &stream, const glm::mat3 & matrix);
std::ostream& operator<<(std::ostream &stream, const glm::mat4 & matrix);
std::ostream& operator<<(std::ostream &stream, const glm::vec3 & vector);
std::ostream& operator<<(std::ostream &stream, const glm::vec4 & vector);




  



#endif // DEBUG_HPP
